home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1843 / 1843.xpi / build.xml next >
Extensible Markup Language  |  2009-11-24  |  12KB  |  291 lines

  1. <?xml version="1.0" ?>
  2.  
  3. <!-- This Ant build file was contributed by Paul McLanahan, pmclanahan@gmail.com.
  4. Added template and version numbers, johnjbarton@johnjbarton.com
  5. Added support for js-doc-tolkit, odvarko@gmail.com -->
  6. <project name="firebug" default="createBranchXPI">
  7.  
  8.     <condition property="isWindows">
  9.         <os family="windows" />
  10.     </condition>
  11.     
  12.     <condition property="isUnix">
  13.         <os family="unix" />
  14.     </condition>
  15.  
  16.     <property environment="env"/>
  17.  
  18.     <!-- Setting properties -->
  19.     <target name="local-check">
  20.         <available file="${basedir}/local.properties"
  21.             property="local.properties.available"/>
  22.     </target>
  23.  
  24.     <target name="properties-local"
  25.             if="local.properties.available"
  26.             depends="local-check">
  27.         <echo message="Loading local properties file"/>
  28.         <property file="local.properties"/>
  29.     </target>
  30.  
  31.     <target name="properties-default-win" if="isWindows">
  32.         <input
  33.             message="Please enter Profile folder name:"
  34.             addproperty="profilefolder"
  35.         />
  36.         <property name="install.dir" value="${env.APPDATA}\Mozilla\Firefox\Profiles\${profilefolder}"/>
  37.     </target>
  38.  
  39.     <target name="properties-default-unix" if="isUnix">
  40.         <input
  41.             message="Please enter Profile folder name:"
  42.             addproperty="profilefolder"
  43.         />
  44.         <property name="install.dir" value="OS Specific Path to:/Mozilla/Firefox/Profiles/${profilefolder}"/>
  45.     </target>
  46.  
  47.     <target name="no-properties-local"
  48.             unless="local.properties.available"
  49.             depends="local-check,properties-default-win,properties-default-unix">
  50.         <property name="update.path" value="http://getfirebug.com/releases"/>
  51.     </target>
  52.  
  53.     <target name="version" depends="properties-local, no-properties-local" description="Compute version number">
  54.         <tstamp/>
  55.         <property name="build_dir" location="./build" />
  56.         <property name="FULLVERSION"  value="${VERSION}${RELEASE}${TRUNK}"/>
  57.         <mkdir dir="${build_dir}/dist" />
  58.         <property name="dist_dir" location="${build_dir}/dist" />
  59.         <property name="FIREBUG-XPI" value="firebug-${VERSION}J${RELEASE}.xpi"/>
  60.     </target>
  61.  
  62.     <!-- eg
  63.         RELEASE=.88
  64.         VERSION=eval
  65.         TRUNK=.1.05 -->
  66.     <property file="content/firebug/branch.properties" />
  67.  
  68.     <!-- Project directories -->
  69.     <property name="src_dir" location="." />
  70.     <property name="build_dir" location="./build" />
  71.     <property name="dist_dir" location="./dist" />
  72.     <!-- relative to branches/firebug1.1 should be branches/eval -->
  73.  
  74.     <property name="excludes" value="**/.*, **/*.jar, **/*.db" />
  75.     <property name="components_dir" location="${src_dir}/components" />
  76.     <available file="${src_dir}/aptanadebugger" property="aptanadebugger"/>
  77.  
  78.     <!-- Targets -->
  79.     <target name="clean" depends="clean-reg">
  80.         <delete dir="${build_dir}" />
  81.         <delete dir="${dist_dir}" />
  82.     </target>
  83.  
  84.     <!-- Expand templates -->
  85.     <target name="install-dependency" description="test tpl files">
  86.         <uptodate property="install.expansion.notRequired" targetfile="${src_dir}/install.rdf">
  87.             <srcfiles dir="${src_dir}" includes="install.rdf.tpl.xml, content/firebug/branch.properties"/>
  88.         </uptodate>
  89.     </target>
  90.  
  91.     <target name="update-dependency" description="test update files">
  92.         <condition property="update.expansion.notRequired">
  93.             <or>
  94.                 <not>
  95.                     <available file="update.rdf.tpl.xml"/>
  96.                 </not>
  97.                 <uptodate targetfile="update.rdf">
  98.                     <srcfiles dir="${src_dir}" includes="update.rdf.tpl.xml, branch.properties"/>
  99.                 </uptodate>
  100.             </or>
  101.         </condition>
  102.     </target>
  103.  
  104.     <target name="expand-templates" depends="expand-install-template, expand-update-template, verify-update-template-expansion" description="Fill in version info">
  105.     </target>
  106.  
  107.     <target name="expand-install-template" depends="install-dependency, version" unless="install.expansion.notRequired" >
  108.         <copy file="${src_dir}/install.rdf.tpl.xml"
  109.             tofile="${src_dir}/install.rdf"
  110.             overwrite="true">
  111.             <filterchain>
  112.                 <replacetokens>
  113.                     <token key="FULLVERSION" value="${FULLVERSION}"/>
  114.                     <token key="VERSION" value="${VERSION}J"/>
  115.                     <token key="RELEASE" value="${RELEASE}"/>
  116.                     <token key="UPDATEPATH" value="${update.path}/firebug/${VERSION}"/>
  117.                 </replacetokens>
  118.             </filterchain>
  119.         </copy>
  120.     </target>
  121.  
  122.     <target name="expand-update-template" depends="update-dependency, version" unless="update.expansion.notRequired" >
  123.         <copy file="${src_dir}/update.rdf.tpl.xml"
  124.             tofile="${build_dir}/update.rdf"
  125.             overwrite="true">
  126.             <filterchain>
  127.                 <replacetokens>
  128.                     <token key="FULLVERSION" value="${FULLVERSION}"/>
  129.                     <token key="VERSION" value="${VERSION}J"/>
  130.                     <token key="RELEASE" value="${RELEASE}"/>
  131.                     <token key="LEAF" value="firebug-${VERSION}${RELEASE}.xpi"/>
  132.                     <token key="UPDATEPATH" value="${update.path}/firebug/${VERSION}"/>
  133.                     <token key="EXPERIMENTORURL" value="http://www.almaden.ibm.com/u/bartonjj"/>
  134.                 </replacetokens>
  135.             </filterchain>
  136.         </copy>
  137.         <echo message="expanded ${src_dir}/update.rdf.tpl.xml"/>
  138.     </target>
  139.  
  140.     <target name="verify-update-template-expansion" depends="update-dependency" if="update.expansion.notRequired">
  141.         <echo message="update.expansion.notRequired true"/>
  142.     </target>
  143.  
  144.     <target name="release-documentation" depends="clean, version, expand-templates">
  145.         <copy file="${src_dir}/docs/index.tpl.html"
  146.             tofile="${src_dir}/docs/index.html"
  147.             overwrite="true">
  148.             <filterchain>
  149.                 <replacetokens>
  150.                     <token key="FIREBUG-VERSION" value="${RELEASE}"/>
  151.                     <token key="CHROMEBUG-VERSION" value="${CHROMEBUG.FULLVERSION}"/>
  152.                     <token key="UPDATEPATH" value="${update.path}"/>
  153.                 </replacetokens>
  154.             </filterchain>
  155.         </copy>
  156.     </target>
  157.  
  158.     <!-- Incremental Build Targets -->
  159.     <target name="dev-setup" depends="create-extension-links, expand-templates">
  160.     </target>
  161.  
  162.     <target name="create-extension-links" depends="version">
  163.         <!-- These links are one line files with paths pointing into our source -->
  164.         <echo message="Writing links from ${install.dir}/extensions to ${basedir}"/>
  165.         <mkdir dir="${install.dir}/extensions" />
  166.  
  167.         <path id="firebug-dev">
  168.             <pathelement location="${basedir}"/>
  169.         </path>
  170.  
  171.         <pathconvert refid="firebug-dev" property="firebug-dev"/>
  172.         <echo message="${firebug-dev}"
  173.             file="${install.dir}/extensions/firebug@software.joehewitt.com" />
  174.     </target>
  175.  
  176.     <target name="firebug-service" depends="version"
  177.         description="Check compreg.dat when service changes">
  178.         <uptodate property="deleteCompreg.notRequired"
  179.                   srcfile="./components/firebug-service.js"
  180.                   targetfile="${install.dir}/compreg.dat" />
  181.     </target>
  182.  
  183.     <target name="clean-reg" depends="firebug-service" unless="deleteCompreg.notRequired"
  184.         description="Delete compreg.dat to reload service" >
  185.         <delete file="${install.dir}/compreg.dat"/>
  186.     </target>
  187.  
  188.     <!-- Distribution XPI Targets -->
  189.     <target name="createChromeJAR">
  190.         <mkdir dir="${build_dir}" />
  191.         <zip destfile="${build_dir}/${ant.project.name}.jar"
  192.             update="true"
  193.             basedir="${src_dir}"
  194.             includes="content/**, locale/**, skin/**"
  195.             excludes="${excludes}"/>
  196.     </target>
  197.  
  198.     <target name="createPlatformJARs">
  199.         <mkdir dir="${build_dir}/Darwin" />
  200.         <mkdir dir="${build_dir}/Linux" />
  201.         <mkdir dir="${build_dir}/linux-gnu" />
  202.         <mkdir dir="${build_dir}/WINNT" />
  203.  
  204.         <zip destfile="${build_dir}/Darwin/${ant.project.name}.jar" update="true"
  205.             basedir="${src_dir}/platform/Darwin" includes="skin/**" excludes="${excludes}" />
  206.         <zip destfile="${build_dir}/Linux/${ant.project.name}.jar" update="true"
  207.             basedir="${src_dir}/platform/Linux"
  208.             includes="skin/**"
  209.             excludes="${excludes}"/>
  210.         <zip destfile="${build_dir}/linux-gnu/${ant.project.name}.jar" update="true"
  211.             basedir="${src_dir}/platform/linux-gnu"
  212.             includes="skin/**"
  213.             excludes="${excludes}"/>
  214.         <zip destfile="${build_dir}/WINNT/${ant.project.name}.jar" update="true"
  215.             basedir="${src_dir}/platform/WINNT"
  216.             includes="skin/**"
  217.             excludes="${excludes}"/>
  218.     </target>
  219.  
  220.     <target name="zipIntoXPI" depends="clean, createChromeJAR, createAptanaJAR">
  221.         <mkdir dir="${dist_dir}" />
  222.         <antcall target="integrateAptana"/>
  223.         <zip destfile="${dist_dir}/${ant.project.name}.xpi" update="true">
  224.             <zipfileset dir="${build_dir}" includes="*.jar" prefix="chrome" />
  225.             <zipfileset dir="${src_dir}" includes="icons/**" prefix="chrome" excludes="${excludes}" />
  226.             <zipfileset dir="${src_dir}/platform" includes="**" prefix="platform" excludes="${excludes}, **/skin/**" />
  227.             <zipfileset dir="${src_dir}/components" includes="*.js" prefix="components" />
  228.             <zipfileset dir="${src_dir}/defaults" includes="**" prefix="defaults" excludes="${excludes}" />
  229.             <zipfileset dir="${src_dir}" includes="install.rdf" />
  230.             <zipfileset dir="${src_dir}" includes="jarred.manifest" fullpath="chrome.manifest"/>
  231.         </zip>
  232.     </target>
  233.  
  234.     <target name="createDistributionXPI" depends="zipIntoXPI" >
  235.         <copy file="${dist_dir}/${ant.project.name}.xpi"
  236.             tofile="${dist_dir}/${ant.project.name}.xpi.zip" />
  237.     </target>
  238.  
  239.     <target name="createBranchXPI" depends="clean, version, expand-templates, zipIntoXPI, release-documentation" >
  240.         <move file="${dist_dir}/firebug.xpi" tofile="${dist_dir}/${FIREBUG-XPI}"/>
  241.         <copy file="${build_dir}/update.rdf" tofile="${dist_dir}/update.rdf" />
  242.     </target>
  243.  
  244.     <target name="createAptanaJAR" if="aptanadebugger">
  245.         <echo message="Create aptanadebugger.jar"/>
  246.         <mkdir dir="${build_dir}" />
  247.         <zip destfile="${build_dir}/aptanadebugger.jar" update="true"
  248.             basedir="${src_dir}/aptanadebugger/"
  249.             includes="content/**, locale/**, skin/**" excludes="${excludes}"/>
  250.     </target>
  251.  
  252.     <target name="integrateAptana" if="aptanadebugger">
  253.         <echo message="Integrate AptanaDebugger"/>
  254.         <concat destfile="${build_dir}/chrome.manifest" force="yes">
  255.             <fileset file="${src_dir}/chrome.manifest"/>
  256.             <fileset file="${src_dir}/aptanadebugger/chrome.manifest"/>
  257.         </concat>
  258.     </target>
  259.  
  260.     <!-- Support for generating docs from Firebug source code using js-doc-toolkit
  261.         See the output in $svn/jsdoc/out directory -->
  262.     <target name="jsdoc" depends="properties-local, no-properties-local"
  263.         description="Generate documentation">
  264.  
  265.         <property name="jsdoc.dir" value="../../jsdoc/"/>
  266.         <property name="jsdoc-toolkit.dir" value="${jsdoc.dir}/jsdoc-toolkit-2.3.0/"/>
  267.         <property name="jsdoc-output.dir" value="${jsdoc.dir}/out/"/>
  268.  
  269.         <path id="jsdoctoolkit">
  270.             <!-- Rhino js.jar 1.7.R2 must be used with jsdoctoolkit-ant-task-1.0.1.jar -->
  271.             <fileset dir="${jsdoc.dir}" includes="*.jar"/>
  272.         </path>
  273.  
  274.         <taskdef name="jsdoctoolkit"
  275.             classpathref="jsdoctoolkit"
  276.             classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"/>
  277.  
  278.         <echo message="Generate doc from Firebug source ($svn/jsdoc/out/)."/>
  279.  
  280.         <!-- Clean the output direcotory -->
  281.         <delete dir="${jsdoc-output.dir}"/>
  282.  
  283.         <!-- Parse all source files -->
  284.         <jsdoctoolkit jsdochome="${jsdoc-toolkit.dir}"
  285.             template="firebug"
  286.             outputdir="${jsdoc-output.dir}"
  287.             inputdir="." />
  288.     </target>
  289.  
  290. </project>
  291.